package projectx.web.base;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;

import projectx.core.base.ProjectXMessage;
import projectx.util.StringUtil;

public abstract class ProjectXSingleSelectListForm extends ProjectXListForm {

	private String _radioSelectedRow;

	protected void validate(ActionErrors errors, ActionMapping mapping,
			HttpServletRequest request) {
		checkSelectedRow(errors);

		if (errors.size() > 0) {
			initViewData(request);
		}
	}

	protected void checkSelectedRow(ActionErrors errors) {
		if (StringUtil.isBlank(_radioSelectedRow)) {
			addError(errors, new ProjectXMessage("E0313"));
		}
	}

	public String getRadioSelectedRow() {
		return _radioSelectedRow;
	}

	public void setRadioSelectedRow(String selectedRow) {
		_radioSelectedRow = selectedRow;
	}
}
